/**
 * Company : SIANGKLOM.
 * Created By : Chatree Siangklom
 * Created On : Oct 4, 2013  1:09:28 PM 
 * e-Mail : dr_chatree@hotmail.com
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : com.tis.database.services.promis.impl
 * File Name : CustomerServicesImpl.java
 * TODO
 */
package com.tis.database.services.promis.impl;

import java.util.List;
import org.hibernate.HibernateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.tis.database.dao.promis.CustomerDao;
import com.tis.database.entitys.promis.Customer;
import com.tis.database.entitys.staging.SdCustomerOutb1;
import com.tis.database.services.promis.ICustomerServices;

/**
 * @author Chatree Siangklom of Administrator
 * Date =Oct 4, 2013 : 1:09:28 PM 
 * CreateBy=Chatree Siangklom
 * TODO
 */
@Service
@Transactional(readOnly=true)
public class CustomerServicesImpl implements ICustomerServices {

	@Autowired
	private CustomerDao customerDao;
	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerServices#save(com.tis.database.entitys.promis.Customer)
	 * Date =Oct 4, 2013 : 1:09:38 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(Customer e) throws HibernateException {
		customerDao.save(e);		
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerServices#save(java.util.List)
	 * Date =Oct 4, 2013 : 1:09:38 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(List<Customer> e) throws HibernateException {
		customerDao.save(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerServices#saveOrUpdate(com.tis.database.entitys.promis.Customer)
	 * Date =Oct 4, 2013 : 1:09:38 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void saveOrUpdate(Customer e) throws HibernateException {
		customerDao.saveOrUpdate(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerServices#saveOrUpdate(java.util.List)
	 * Date =Oct 4, 2013 : 1:09:38 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void saveOrUpdate(List<Customer> e) throws HibernateException {
		customerDao.saveOrUpdate(e);
		
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerServices#Search(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int)
	 * Date =Oct 4, 2013 : 1:09:38 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<Customer> Search(	String customerCode, 
									String idNo,
									String taxId, 
									String createdOnStart, 
									String createdOnEnd,
									int maxResult) throws HibernateException, Exception {
		return customerDao.Search(customerCode, idNo, taxId, createdOnStart, createdOnEnd, maxResult);
		
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerServices#FindByIs(java.lang.String, java.lang.String, java.lang.String, int)
	 * Date =Oct 30, 2013 : 1:57:11 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<Customer> FindByIs(String status, String syncIsstaging, String syncIssync, int maxResult) throws Exception {
		// TODO Auto-generated method stub
		return customerDao.FindByIs(status, syncIsstaging, syncIssync, maxResult);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerServices#findById(java.lang.String)
	 * Date =Oct 31, 2013 : 4:04:48 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public Customer findById(String id) {
		return customerDao.findById(id);
	}

}
